#import <UIKit/UIKit.h>
#import "MainView.h"


int __deviceOrientation;

@implementation MainView 

- (id)initWithFrame:(struct CGRect)rect {

__deviceOrientation = [ UIHardware deviceOrientation: YES ];
self = [ super initWithFrame: rect ];
navBar = [ self createNavBar ];
[self addSubview: navBar];
transitionView = [ self createTransitionView ];
[ self addSubview: transitionView ];
        

}

- (UINavigationBar *)createNavBar {
    CGRect rect = [ self frame ];
    UINavigationBar *nav = [ [ UINavigationBar alloc ] initWithFrame:
        CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, 48.0f)
    ];

    [ nav setDelegate: self ];
    [ nav enableAnimation ];

    navItem = [[UINavigationItem alloc] initWithTitle:@"YO"];
    [ nav pushNavigationItem: navItem ];
	
	[nav showButtonsWithLeftTitle:@"Clear"
                         rightTitle:@"Settings" leftBack: NO
                ];



    return nav;
}


- (UITransitionView *)createTransitionView {
    CGRect rect = [ self frame ];
    float offset = 48.0;

    UITransitionView *transition = [ [ UITransitionView alloc ] 
        initWithFrame:
            CGRectMake(rect.origin.x, offset, rect.size.width,
                       rect.size.height - offset)
    ];
    return transition;
}


- (void)dealloc {
        [ navBar release ];
	[ super dealloc ];
}



@end
